<template>
  <div id="app">
    <div class="top-switch">
      <a class="switch-btn" href="http://localhost:3000/" target="_self">查看ANR数据分析</a>
      <a class="switch-btn" href="http://localhost:3001/analysis" target="_self">查看售后退货数据</a>
    </div>
    <router-view />
  </div>
</template>

<script setup>
import { onMounted } from 'vue'
import { useAnrStore } from './stores/anr'

const anrStore = useAnrStore()

onMounted(() => {
  // 初始化数据
  anrStore.loadInitialData()
})
</script>

<style>
#app {
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: #f5f7fa;
}

.top-switch {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.switch-btn {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  color: #409eff;
  border: 1px solid #409eff;
  border-radius: 4px;
  text-decoration: none;
}

.switch-btn:hover {
  background: #ecf5ff;
}
</style>

